﻿function DeleteCheck(name) {
    return confirm('Do you want to delete it ?');
}

function ShowHide(id1, id2) {
    var div1 = document.getElementById(id1);
    var div2 = document.getElementById(id2);

    if (div1.style.display != "block") {
        div1.style.display = "block";
        div2.style.display = "block";
    }
    else {
        div1.style.display = "none";
        div2.style.display = "none";
    }
}

function Turn(id1, id2, self, flagCol, text) {
    var div1 = document.getElementById(id1);
    var div2 = document.getElementById(id2);
    var selfLink = document.getElementById(self);
    var col = document.getElementById(flagCol);

    if (col.value == '0') {
        div1.style.display = "none";
        div2.style.display = "block";
        selfLink.innerHTML = "选择" + text;
        col.value = '1';
    }
    else {
        div1.style.display = "block";
        div2.style.display = "none";
        selfLink.innerHTML = "新建" + text;
        col.value = '0';
    }
}

function GetRequest() {
    var url = location.search;
    var theRequest = new Object();
    if (url.indexOf("?") != -1) {
        var str = url.substr(1);
        strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
            theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
        }
    }
    return theRequest;
}

function CallPop(hiddenChosenId, cssName) {
    var lblChosenId = document.getElementById(hiddenChosenId)
    var lblValues = lblChosenId.value;
    ids = lblValues.split(";");

    $("input").each(function (index, domEle) {
        if (domEle.parentElement.className == cssName) {
            domEle.checked = false;
        }
    });

    $("input").each(function (index, domEle) {
        if (domEle.parentElement.className == cssName) {
            for (var i = 0; i < ids.length; i++) {
                if (domEle.parentElement.FlagValue == ids[i]) {
                    domEle.checked = true;
                }
            }
        }
    });
}